package com.koron.device.controller;

import com.koron.bean.base.Response;
import com.koron.device.bean.SLanguagesConvert;
import com.koron.device.service.SLanguagesConvertService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 多语言转换表(SLanguagesConvert)表控制层
 *
 * @author makejava
 * @since 2023-10-12 09:13:19
 */
@Api(tags = "sLanguagesConvert")
@RestController
@RequestMapping("sLanguagesConvert")
public class SLanguagesConvertController {
    /**
     * 服务对象
     */
    @Resource
    private SLanguagesConvertService sLanguagesConvertService;

    /**
     * 通过主键查询单条数据
     *
     * @param paramId 主键
     * @return 单条数据
     */
    @GetMapping("queryById")
    @ApiOperation(value = "通过paramId查询单条数据")
    public Response<List<SLanguagesConvert>> queryById(String paramId) {
        return Response.ok(sLanguagesConvertService.queryById(paramId));
    }

    /**
     * 新增数据
     *
     * @param sLanguagesConvert 实体
     * @return 新增结果
     */
    @PostMapping("add")
    @ApiOperation(value = "add")
    public Response<SLanguagesConvert> add(@RequestBody SLanguagesConvert sLanguagesConvert) {
        return Response.ok(sLanguagesConvertService.insert(sLanguagesConvert));
    }

    /**
     * 编辑数据
     *
     * @param sLanguagesConvertList 实体
     * @return 编辑结果
     */
    @PostMapping("edit")
    @ApiOperation(value = "edit")
    public Response<Boolean> edit(@RequestBody List<SLanguagesConvert> sLanguagesConvertList) {
        return Response.ok(sLanguagesConvertService.update(sLanguagesConvertList));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping("deleteById")
    @ApiOperation(value = "deleteById")
    public Response<Boolean> deleteById(String id) {
        return Response.ok(sLanguagesConvertService.deleteById(id));
    }
    @PostMapping("init")
    @ApiOperation(value = "init")
    public Response<Integer> init() {
        return Response.ok(sLanguagesConvertService.init());
    }


}

